package xhwl.hmo.mall.adapter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import java.util.List;

import xhwl.hmo.mall.R;
import xhwl.hmo.mall.http.bean.resp.OrderDetailResp;

public class InfoOderSuitesAdapter extends BaseAdapter {
    private Context context;
    private List<OrderDetailResp.DEV_INFOBean> mylist;

    public InfoOderSuitesAdapter(Context context, List<OrderDetailResp.DEV_INFOBean> mylist) {
        this.context = context;
        this.mylist = mylist;
    }

    @Override
    public int getCount() {
        return mylist.size();
    }

    @Override
    public Object getItem(int position) {
        return mylist.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @SuppressLint({"NewApi", "ResourceAsColor"})
    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        ViewHolder holder;
        if (convertView == null) {
            holder = new ViewHolder();
            convertView = LayoutInflater.from(context).inflate(R.layout.item_suit_products, null);
            holder.names_suit = (TextView) convertView.findViewById(R.id.names_suit);
            holder.num_suit = (TextView) convertView.findViewById(R.id.num_suit);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.names_suit.setText(mylist.get(position).getDEV_NAME());
        holder.num_suit.setText("*" + mylist.get(position).getDEV_NUM());
        return convertView;
    }

    public class ViewHolder {
        TextView names_suit;
        TextView num_suit;
    }
}
